package com.jsmile.cloud.authc.sys.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.jsmile.cloud.authc.api.req.sys.ReqSysResourceUpdate;

import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @author 龚亮
 * @version 1.0
 * @desc 为了薪资破万，还是睡一会儿吧...!
 * @date 2019年11月01日 08:52:39
 */
@ApiModel
@Data
@TableName("t_op_sys_resources")
public class SysResources extends Model<SysResources> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    @ApiModelProperty(value = "资源名称")
    private String name;
    @ApiModelProperty(value = "资源地址")
    private String url;
    @ApiModelProperty(value = "parent_id")
    private Long parentId;
    @ApiModelProperty(value = "权限编码")
    private String permCode;
    @ApiModelProperty(value = "资源图标")
    private String iconCls;
    @ApiModelProperty(value = "资源级别")
    private Integer level;
    @ApiModelProperty(value = "排序")
    private Integer sort;
    @ApiModelProperty(value = "1菜单 2 权限 3外部链接")
    private Integer menuType;
    @ApiModelProperty(value = "描述")
    private String remark;
    @ApiModelProperty(value = "创建时间")
    private java.util.Date createTime;
    @ApiModelProperty(value = "创建者")
    private String createBy;
    @ApiModelProperty(value = "更新时间")
    private java.util.Date updateTime;
    @ApiModelProperty(value = "更新者")
    private String updateBy;
    @ApiModelProperty(value = "是否启用 1是  0否")
    private Integer enable;
    @ApiModelProperty(value = "是否叶子节点")
    private Integer leaf;
    @ApiModelProperty(value = "所属系统")
    private String sysNo;
    @ApiModelProperty(value = "租户id")
    private Long tenantId;
    @TableLogic
    @ApiModelProperty(value = "是否删除 1是 0否")
    private Integer delFlag;

    public static SysResources create(ReqSysResourceUpdate reqSysResourceUpdate) {
        SysResources sysResources = BeanUtil.toBean(reqSysResourceUpdate, SysResources.class);
        return sysResources;
    }
}
